# main.py
from fastapi import FastAPI
from db import engine
import service.products as products_router
import service.specifications as specifications_router
import service.hot_index_history as hot_index_history_router
import service.gpt as gpt_router

app = FastAPI()



# 创建数据库表
@app.on_event("startup")
async def startup_event():
    from db import Base
    Base.metadata.create_all(bind=engine)

# 包含路由
# app.include_router(products_router.router)
# app.include_router(specifications_router.router)
# app.include_router(hot_index_history_router.router)
app.include_router(gpt_router.router)

if __name__ == "__main__":
    import uvicorn
    uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)